<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>04-练习作业-axios+swiper.html</title>
</head>

<body>
    <h1>通过axios请求数据接口获取图片-然后使用swiper实现轮播图效果</h1>

    <div id="a1"></div>
    <script src="./js/axios.min.js"></script>
    <script src="./swiper/swiper.min.js"></script>
    <link rel="stylesheet" href="./swiper/swiper.min.css">
    <script>
        axios({
            url: `https://picsum.photos/v2/list?limit=2`,
            mtehod: 'GET',
            params: {
                limit: 10
            }
        }).then(function (res) {
            console.log(res);

            res.data.forEach(item => (
                // console.log(res)
                
            ))

        })
    </script>
    <!--  <script src="./axios.min.js"></script>
</head>

<body>
    <button id="but">发送get请求</button>
    <hr>
    <script>
        but.onclick = function () {
            axios({
                url: 'https://cnodejs.org/api/v1/topics',
                method: 'GET',
                params: {
                    page: 1, limit: 1
                }
            }).then(function (res) {
                console.log(res.data);
            })
        }
    </script> -->

    <script>
        /**
         * 接口地址: https://picsum.photos/v2/list
         * 请求方式: GET
         * 请求参数: limit: 数值, 需要的图片数量
         * 完整示例: https://picsum.photos/v2/list?limit=2
         * 
         * 
        */

        /*
            
            数据接口响应数据结果如下所示:download_url属性为图片在线地址
                    
            [
                {
                "id": "0",
                "author": "Alejandro Escamilla",
                "width": 5000,
                "height": 3333,
                "url": "https://unsplash.com/photos/yC-Yzbqy7PY",
                "download_url": "https://picsum.photos/id/0/5000/3333"
                },
                {
                "id": "1",
                "author": "Alejandro Escamilla",
                "width": 5000,
                "height": 3333,
                "url": "https://unsplash.com/photos/LNRyGwIJr5c",
                "download_url": "https://picsum.photos/id/1/5000/3333"
                }
            ] 
        */
    </script>
</body>

</html>